<!DOCTYPE html>
<html lang="ch">

<head>
  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
  <meta content="yes" name="apple-touch-fullscreen" />
  <meta content="black" name="apple-mobile-web-app-status-bar-style" />
  <meta content="telephone=no" name="format-detection" />
  <title>易骏云 - BI</title>
  <link href="css/iview.css" rel="stylesheet" />
  <link href="css/vant.css" rel="stylesheet" />
  <link href="css/vue_vant.css" rel="stylesheet" />
  <link rel="stylesheet" href="image/icon/iconfont.css" />
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/vue-router/3.5.1/vue-router.min.js"></script>
  <style>
    .container {
      display: flex;
      flex-wrap: wrap;
      /* 允许换行 */
      gap: 10px;
      margin-top:200px;
      /* 盒子之间的间距 */
    }

    .box {
      width: calc(50% - 5px);
      /* 每行两个盒子，减去间距 */
      height: 50px;
      /* 盒子高度 */
      /* background-color: #f0f0f0; */
      display: flex;
      align-items: center;
      justify-content: center;
      border: 1px solid #f10215;
      color: #f10215;
      font-size: 18px;
    }
  </style>
</head>

<body>
  <div id="app" v-cloak>
    <!-- 订货会tab -->
    <div class="container">
      <a class="box" v-for="(V,I) in orderList" :key="I" @click="orderTab(V)">{{V.ordername}}</a>
    </div>
  </div>
  <script src="js/vue.min.js"></script>
  <script src="js/axios.min.js"></script>
  <script src="js/jquery-3.3.1.min.js"></script>
  <script src="js/iview.min.js"></script>
  <script src="js/swiper.min.js"></script>
  <script src="js/echarts.min.js"></script>
  <script src="js/vant.min.js" type="text/javascript" charset="utf-8"></script>
  <script src="js/hammer.js" type="text/javascript" charset="utf-8"></script>
  <script>
   

    new Vue({
      el: "#app",
      data() {
        return {
          dateActive: '1',
          active: '1',
          rData: {
            dtlist: []
          },
          url: '',
          access_token: '',
          begin_end_date: [],
          show: false,
          showM: false,
          minDate: new Date(2010, 0, 1),
          maxDate: new Date(),
          currentDate: new Date(),
          billdate: '',
          dataList: [],
          rankingAmount: 1,
          stylesRanking: 1,
          regional: 1,
          sum: 0,
          imgEnlarged: false,
          url: '',
          screeShow: false,
          stylesList: [],//款式过滤条件
          selectScreeList: [],//存放所有选中的筛选条件
          queryTest: '',
          orderList: [{
            id: 347,
            ordername: "订货会1"
          },
          {
            id: 347,
            ordername: "订货会2"
          },
          {
            id: 347,
            ordername: "订货会3"
          },
          {
            id: 347,
            ordername: "订货会4"
          }
          ],
          imgurl: 'https://hz.enginesoft.cn/eboss_yun/server',
        };
      },
      methods: {
        select(index, title) {
          this.getList()
        },
        getQueryParam(param) {
                    const search = window.location.search.substring(1); // 去掉开头的 '?'
                    const params = search.split('&');
                    for (let i = 0; i < params.length; i++) {
                        const [key, value] = params[i].split('=');
                        if (key === param) {
                            return decodeURIComponent(value); // 解码 URL 编码的字符
                        }
                    }
                    return null; // 参数不存在
                },
        orderTab(V) {
          window.location.href = `rankingorderDetails.html?orderid=`+V.id;
        },
        filtration(item, index, listitem) {
          let num = this.selectScreeList[index].findIndex(i => i === listitem.id);
          if (num > -1) {
            this.selectScreeList[index].splice(num, 1)
          } else {
            this.selectScreeList[index].push(listitem.id)
          }
        },
        openInstitutions() {

        },
        getScreenList() {
          let that = this
          $.ajax({
            url: 'http://hz.ebosserp.com/eBoss_YUN/webapi.ashx',
            type: "post",
            data: JSON.stringify({
              api: "dhh_GetAttrib.t",
              token: this.token,
            }),
            success: (res) => {
              if (res.code == 200) {
                this.stylesList = res.data;
                this.selectScreeList = Array.from({ length: this.stylesList.length || 0 }, () => []);
              } else {
                that.$Message.error({
                  content: "暂无数据",
                  duration: 5,
                });
              }
            }
          })
        },
        // 筛选后重新请求
        getScreen() {
          this.attribsData = {};
          this.selectScreeList.forEach((item, index) => {
            if (item.length > 0) {
              this.attribsData['attrib' + Number(this.stylesList[index].attribdef)] = item.join(',')
            }
          })
          this.getList()
        },
        openScreen() {
          this.screeShow = true;
        },
        enlarged(data) {
          this.imgEnlarged = true;
          this.url = this.imgurl + data.image1_path
        },
        getList() {
          let that = this
          $.ajax({
            url: this.url,
            type: "post",
            data: JSON.stringify({
              orderid: 347,
              api: "dhh_GetStyleRank.t",
              token: this.token,
              rank_type_1: this.rankingAmount,
              rank_type_2: this.stylesRanking,
              rank_type_3: this.regional,
              attribs: this.attribsData,
              access_token: this.access_token,
              style: this.queryTest
            }),
            success: (res) => {
              if (res.code == 200) {
                this.dataList = res.data;
                this.dataList.forEach((item, index) => {
                  this.sum += item.user_qty
                })
              } else {
                that.$Message.error({
                  content: "暂无数据",
                  duration: 5,
                });
              }
            }
          })
        },
        getQueryData() {
          let oSearchItem = {};
          let searchString = window.location.search;
          let reg = /[?&][^?&]+=[^?&]+/g;
          let arr = searchString.match(reg);
          if (arr) {
            arr.forEach((item) => {
              let tempArr = item.substring(1).split("=");
              let key = decodeURIComponent(tempArr[0]);
              let value = decodeURIComponent(tempArr[1]);
              oSearchItem[key] = value;
            });
          }
          return oSearchItem
        },
      },
      created() {
        if (this.getQueryData().token) {
          console.log('this.getQueryData().token', this.getQueryData().token)
          sessionStorage.setItem('token_', this.getQueryData().token)
          sessionStorage.setItem('token', String(this.getQueryData().ccode) + this.getQueryData().token)
        }
      },
      mounted() {
        this.token = sessionStorage.getItem('token_') //'08CA02B70D60473399593A249F63A645'1
        this.access_token = sessionStorage.getItem('token')
        this.url = 'http://hz.ebosserp.com/eBoss_YUN/webapi.ashx';
        this.getScreenList()
        this.getList()
      }
    });
    const element = document.getElementById('app');
    const hammer = new Hammer(element);
    hammer.on('swipe', function (ev) {
      switch (ev.direction) {
        // case Hammer.DIRECTION_LEFT:
        // 	alert('Swiped left');
        // 	break;
        case Hammer.DIRECTION_RIGHT:
          window.history.go(-1)
          break;
        // 可以添加其他方向的处理...  
      }
    })
  </script>

</body>

</html>